<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="项目价格" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doSave(flag){
		document.getElementById("buttonDiv").style.display="none";
		document.getElementById("waitDiv").style.display="";
		document.getElementById("continue_flag").value=flag;
		frm.submit();
	}
	function doCancel(){
		parent.ClosePop();
	}
	function selectProduct(){
		var url="/base/ProductMainForSelect.ihtm";
		ShowIframe("选择材料",url,900,500,"selectProductCallBack()");
	}
	function selectProductCallBack(){
		if(popRetVal!=null){
			document.getElementById("estPrice.proId").value=popRetVal[0];
			document.getElementById("estPrice.proName").value=popRetVal[2];
			document.getElementById("estPrice.unit").value=popRetVal[3];
			document.getElementById("proFlagSpan").style.display="";
		}
	}
	function selectMakeRequire(){
		var url="/base/MakeRequireListForSelect.ihtm";
		ShowIframe("选择制作要求",url,900,500,"selectMakeRequireCallBack()");
	}
	function selectMakeRequireCallBack(){
		if(popRetVal!=null){
			var theValue="";
			for(i=0;i<popRetVal.length;i++){
				if(theValue!=null && theValue!=""){
					theValue=theValue+";";
				}
				theValue=theValue+popRetVal[i][0];
			}
			document.getElementById("estPrice.makeRequire").value=theValue;
		}
	}
	function selectUnit(){
		var url="/base/UnitListForSelect.ihtm";
		ShowIframe("选择单位",url,300,400,"selectUnitCallBack()");
	}
	function selectUnitCallBack(){
		if(popRetVal!=null){
			document.getElementById("estPrice.unit").value=popRetVal[1];
		}
	}
	function selectMakeType(){
		var url="/base/MakeTypeListForSelect.ihtm";
		ShowIframe("选择项目类型",url,310,500,"selectMakeTypeCallBack()");
	}
	function selectMakeTypeCallBack(){
		if(popRetVal!=null){
			document.getElementById("estPrice.makeTypeId").value=popRetVal[0];
			document.getElementById("mtName").value=popRetVal[1];
		}
	}
	
	function doSpeChange(){
		var lengthStr=document.getElementById("estPrice.length").value;
		var widthStr=document.getElementById("estPrice.width").value;
		if(lengthStr!="" && widthStr!="" && !isNaN(lengthStr) && !isNaN(widthStr)){
			document.getElementById("estPrice.specification").value=lengthStr+"m x "+widthStr+"m高";
		}
	}
	function showMe(){
		if(checkNavigator()[0]!="msie"){
			document.getElementById("attach_file").className="";
		}
		showFormErrorMsg();
	}
	function clearAttach(){
		document.getElementById("attachDelete").value="Y";
		document.getElementById("attSpan").style.display="none";
	}
	function doProNameChange(){
		document.getElementById("estPrice.proId").value="0";
		document.getElementById("proFlagSpan").style.display="none";
	}
</script>
</head>
<body oncontextmenu="return false" onLoad="showMe();" class="sheet modal-dialog" style=" padding-top:15px;">
<div class="sheet-main" id="bodyDiv" style="width:380px;">
	<form name="frm" method="post" enctype="multipart/form-data">
	  <div class="sheet-list" style="width:100%">
	    <div class="modal-main search-business">
	    	<div style="width:100%;">
				<c:if test="${id==null || id==''}"><c:set var="pageTopTitle" value="新增项目价格" /></c:if>
				<c:if test="${id!=null && id!=''}"><c:set var="pageTopTitle" value="编辑项目价格" /></c:if>
				<%@ include file="../inc/PageTop.jsp"%>
				<table border="0" cellspacing="1" cellpadding="1" align="center" class="table-a">
					<tr>
				      	<th>项目类型：</th>
				      	<td>
							<spring:bind path="command.mtName">
							<input type="text" class="TextBox readonly" readonly="true" id="${status.expression}" name="${status.expression}" value="${status.value}">
							<img class="make-a" src="/images/icon_add.gif" style="cursor:pointer;" onClick="selectMakeType();">
							<script language="javascript">
								setFormErrorMsg('<c:out value="${status.errorMessage}" />',1);
							</script>
							</spring:bind>
							<spring:bind path="command.estPrice.makeTypeId">
								<input type="hidden" id="${status.expression}" name="${status.expression}" value="${status.value}">
							</spring:bind>
				     	</td>
					</tr>
					<tr>
				      	<th>材质：</th>
				      	<td>
							<spring:bind path="command.estPrice.proName">
				      		<input type="text" <c:if test="${enterpriseInfo.busiProd=='SELECT'}">class="TextBox readonly" readonly="readonly"</c:if><c:if test="${enterpriseInfo.busiProd!='SELECT'}">class="TextBox"</c:if> maxlength="100" id="${status.expression}" onKeyUp="goNextInput('estPrice.width');" name="${status.expression}" value="${status.value}" onChange="doProNameChange();">
				      		<img class="make-a" src="/images/icon_add.gif" style="cursor:pointer;" onClick="selectProduct();" title="价格只与项目类型相关，材质可以直接录入，也可以选择库存材料"><span class="MustInput" id="proFlagSpan" <c:if test="${command.estPrice.proId==0}">style="display:none"</c:if>>*</span>
							<script language="javascript">
								setFormErrorMsg('<c:out value="${status.errorMessage}" />',2,'estPrice.proName');
							</script>
							</spring:bind>
							<spring:bind path="command.estPrice.proId">
								<input type="hidden" id="${status.expression}" name="${status.expression}" value="${status.value}" >
							</spring:bind>
				     	</td>
					</tr>
					<tr>
				      	<th>宽x高：</th>
				      	<td>
							<spring:bind path="command.estPrice.length">
							<input type="text" class="TextBox" style="width:40px" maxlength="10" onKeyUp="goNextInput('estPrice.width');" onChange="doSpeChange();" name="${status.expression}" id="${status.expression}" value="${status.value}">
					        <script language="javascript">
					          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',3,'estPrice.length');
					        </script>
					      	</spring:bind>
					      	x
					      	<spring:bind path="command.estPrice.width">
							<input type="text" class="TextBox" style="width:40px" maxlength="10" onKeyUp="goNextInput('estPrice.specification');" onChange="doSpeChange();" name="${status.expression}" id="${status.expression}" value="${status.value}">
					        <script language="javascript">
					          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',3,'estPrice.width');
					        </script>
					      	</spring:bind>
				     	</td>
					</tr>
					<tr>
				      	<th>规格：</th>
				      	<td>
							<spring:bind path="command.estPrice.specification">
				      		<input type="text" class="TextBox" maxlength="50" id="${status.expression}" onKeyUp="goNextInput('estPrice.unit');" name="${status.expression}" value="${status.value}">
							  <script language="javascript">
								setFormErrorMsg('<c:out value="${status.errorMessage}" />',4,'estPrice.specification');
							  </script>
							</spring:bind>
				     	</td>
					</tr>
					<tr>
				      	<th>单位：</th>
				      	<spring:bind path="command.estPrice.unit">
				      	<td>
				      		<input type="text" class="TextBox" maxlength="10" id="${status.expression}" onKeyUp="goNextInput('priceStr');" name="${status.expression}" value="${status.value}">
				      		<img class="make-a" src="/images/icon_add.gif" style="cursor:pointer;" onClick="selectUnit();">
							<script language="javascript">
								setFormErrorMsg('<c:out value="${status.errorMessage}" />',5,'estPrice.unit');
							</script>
				     	</td>
				     	</spring:bind>
					</tr>
					<tr>
			      		<th><span class="MustInput">*</span>单价：</th>
				      	<spring:bind path="command.priceStr">
				      	<td>
				      		<input type="text" class="TextBox" maxlength="10" id="${status.expression}" onKeyUp="goNextInput('estPrice.makeRequire');" name="${status.expression}" value="${status.value}">
							  <script language="javascript">
								setFormErrorMsg('<c:out value="${status.errorMessage}" />',6,'priceStr');
							  </script>
				     	</td>
				     	</spring:bind>
					</tr>
					<tr>
				      	<th>制作要求：</th>
				      	<td>
							<spring:bind path="command.estPrice.makeRequire">
				      		<textarea class="TextBox" style="width:160px;height:60px" id="${status.expression}" name="${status.expression}">${status.value}</textarea>
				      		<img class="make-a" src="/images/icon_add.gif" style="cursor:pointer;" onClick="selectMakeRequire();">
							  <script language="javascript">
								setFormErrorMsg('<c:out value="${status.errorMessage}" />',7,'estPrice.makeRequire');
							  </script>
							</spring:bind>
				     	</td>
					</tr>
					<tr>
				    	<th>备注：</th> 
				    	<spring:bind path="command.estPrice.mark">
				    	<td>
				    		<textarea class="TextBox" style="width:160px;height:60px" id="${status.expression}" name="${status.expression}">${status.value}</textarea>
					          <script language="javascript">
					          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',8,'estPrice.mark');
					          </script>
				    	</td>
				    	</spring:bind>
				    </tr>
				    <tr>
						<th>产品图片：</th>			    	
				    	<td>
				    		<input type="file" class="TextBox" style="width:160px" name="attach_file" id="attach_file">
							<c:if test="${command.attachDelete=='N' && command.estPrice.attachFile!=null && command.estPrice.attachFile!=''}">
								<span id="attSpan">
								<a href="${command.estPrice.attachFile}" target="_blank">查看</a>
								<a href="javascript:clearAttach();">删除</a>
								</span>
							</c:if>
				    	</td>
				    </tr>
				</table>
			</div>
	  	</div>
	  </div>
		<div class="modal-buttom" id="buttonDiv">
			<input type="button" class="buttom-a" value=" 保 存 " onClick="doSave('');">
			<c:if test="${id!=null && id!=''}">
				<input type="button" class="buttom-a" value="保存并新增" onClick="doSave('1');">
			</c:if>
			<input type="button" class="buttom-a" value=" 取 消 " onClick="doCancel();">
			<input type="hidden" name="continue_flag" id="continue_flag" value="0">
			<spring:bind path="command.attachDelete">
				<input type="hidden" name="${status.expression}" id="${status.expression}" value="${status.value}">
			</spring:bind>
		</div>
		<div class="modal-buttom" id="waitDiv" style="display:none">
			<span style="color:#ffffff">请稍候...</span>
		</div>
	</form>
</div>		
</body>
</html>